package com.dc.refactoring._2_在对象之间搬移特性._2_MoveField.oldObject;

import lombok.Data;

/**
 * Description: 搬移字段_账户，当前业务想将 利率字段搬移到 账户类型类中
 * @author: gdc
 * @date: 2020/11/14
 * @version 1.0
 */
@Data
public class Account {
    /**
     * 账户类型
     */
    private AccountType accountType;
    /**
     * 利率（本字段需要搬移到 AccountType 类中）
     */
    private double interestRate;

    public double interestForAmountDays(double amount, int days) {
        return interestRate * amount * days / 365;
    }

    public double getInterestRate() {
        return interestRate;
    }

    public void setInterestRate(double interestRate) {
        this.interestRate = interestRate;
    }
}
